﻿// /*
//     ------------------- Code Monkey -------------------
//
//     Thank you for downloading the Code Monkey Utilities
//     I hope you find them useful in your projects
//     If you have any questions use the contact form
//     Cheers!
//
//                unitycodemonkey.com
//     --------------------------------------------------
//  */
//
// using System;
// using UnityEngine;
//
// namespace CodeMonkey
// {
//     /*
//      * Debug Class with various helper functions to quickly create buttons, text, etc
//      * */
//     public static class CMDebug
//     {
//         // Creates a World Text object at the world position
//         public static void Text(string text, Vector3 localPosition = default, Transform parent = null, int fontSize = 40, Color? color = null, TextAnchor textAnchor = TextAnchor.UpperLeft, TextAlignment textAlignment = TextAlignment.Left, int sortingOrder = UtilsClass.sortingOrderDefault)
//         {
//             UtilsClass.CreateWorldText(text, parent, localPosition, fontSize, color, textAnchor, textAlignment, sortingOrder);
//         }
//
//         // World text pop up at mouse position
//         public static void TextPopupMouse(string text)
//         {
//             UtilsClass.CreateWorldTextPopup(text, UtilsClass.GetMouseWorldPosition());
//         }
//
//         // Creates a Text pop up at the world position
//         public static void TextPopup(string text, Vector3 position)
//         {
//             UtilsClass.CreateWorldTextPopup(text, position);
//         }
//
//         // Text Updater in World, (parent == null) = world position
//         public static FunctionUpdater TextUpdater(Func<string> GetTextFunc, Vector3 localPosition, Transform parent = null)
//         {
//             return UtilsClass.CreateWorldTextUpdater(GetTextFunc, localPosition, parent);
//         }
//
//         // Text Updater in UI
//         public static FunctionUpdater TextUpdaterUI(Func<string> GetTextFunc, Vector2 anchoredPosition)
//         {
//             return UtilsClass.CreateUITextUpdater(GetTextFunc, anchoredPosition);
//         }
//
//         // Text Updater always following mouse
//         public static void MouseTextUpdater(Func<string> GetTextFunc, Vector3 positionOffset = default)
//         {
//             var gameObject = new GameObject();
//             FunctionUpdater.Create(() =>
//             {
//                 gameObject.transform.position = UtilsClass.GetMouseWorldPosition() + positionOffset;
//                 return false;
//             });
//             TextUpdater(GetTextFunc, Vector3.zero, gameObject.transform);
//         }
//
//         // Trigger Action on Key
//         public static FunctionUpdater KeyCodeAction(KeyCode keyCode, Action onKeyDown)
//         {
//             return UtilsClass.CreateKeyCodeAction(keyCode, onKeyDown);
//         }
//
//
//         // Debug DrawLine to draw a projectile, turn Gizmos On
//         public static void DebugProjectile(Vector3 from, Vector3 to, float speed, float projectileSize)
//         {
//             var dir = (to - from).normalized;
//             var pos = from;
//             FunctionUpdater.Create(() =>
//             {
//                 Debug.DrawLine(pos, pos + dir * projectileSize);
//                 var distanceBefore = Vector3.Distance(pos, to);
//                 pos += dir * speed * Time.deltaTime;
//                 var distanceAfter = Vector3.Distance(pos, to);
//                 if (distanceBefore < distanceAfter) return true;
//                 return false;
//             });
//         }
//     }
// }

